{extend name="base" /}
{block name="body"}
<div class="layui-card">
    <div class="layui-card-body">
        <blockquote class="layui-elem-quote layui-text">
            会员分析：<span class="text-danger"></span><span class="text-danger"></span>
        </blockquote>
        <div id="container" style="width: 80%;height:600px;"></div>
        <div id="main" style="width: 80%;height:600px;"></div>
    </div>
</div>
{/block}
{block name="js"}
{js href="__JS__/echarts.min.js,__JS__/wonderland.js" /}
<script type="text/javascript">
setTimeout(getViews,300);
setInterval(getViews,60000);
function getViews()
{
    $.post('get_deposit.html',function(res){
        var myChart = echarts.init(document.getElementById('container'), 'wonderland');
        var res = $.parseJSON(res);
        myChart.setOption({
            title: {
                text: '理财通会员投资占比',
                subtext: '纯属虚构',
                left: 'center'
            },
            tooltip: {
                trigger: 'item'
            },
            legend: {
                orient: 'vertical',
                left: 'left',
            },
            series: [
                {
                    type: 'pie',
                    radius: '50%',
                    data: res[0],
                    emphasis: {
                        itemStyle: {
                            shadowBlur: 10,
                            shadowOffsetX: 0,
                            shadowColor: 'rgba(0, 0, 0, 0.5)'
                        }
                    }
                }
            ]
        });

        //每日买入统计
        var dom = document.getElementById("main",'wonderland');
        var myChart = echarts.init(dom);
        var colors = ['#5470C6', '#91CC75', '#EE6666'];
        var option = {
            color: colors,
            title: {
                text: '每日存入、取出统计',
                subtext: '纯属虚构',
                left: 'center'
            },
            tooltip: {
                trigger: 'axis',
                axisPointer: {
                    type: 'cross'
                }
            },
            legend: {
                orient: 'vertical',
                left: 'left',
            },
            xAxis: [
                {
                    type: 'category',
                    axisTick: {
                        alignWithLabel: true
                    },
                    data: res[1].date
                }
            ],
            yAxis: [
                {
                    position: 'right',
                    axisLine: {
                        show: true,
                        lineStyle: {
                            color: colors[0]
                        }
                    },
                    axisLabel: {
                        formatter: '{value}'
                    }
                },
                {
                    position: 'right',
                    offset: 60,
                    axisLine: {
                        show: true,
                        lineStyle: {
                            color: colors[1]
                        }
                    },
                    axisLabel: {
                        formatter: '{value}'
                    }
                },
                {
                    position: 'left',
                    axisLine: {
                        show: true,
                        lineStyle: {
                            color: colors[2]
                        }
                    },
                    axisLabel: {
                        formatter: '{value}'
                    }
                }
            ],
            series: [
                {
                    name: '买入',
                    type: 'bar',
                    data: res[1].buy
                },
                {
                    name: '卖出',
                    type: 'bar',
                    yAxisIndex: 1,
                    data: res[1].sell
                },
                {
                    name: '盈亏',
                    type: 'line',
                    yAxisIndex: 2,
                    data: res[1].surplus
                }
            ]
        };

        if (option && typeof option === 'object') {
            myChart.setOption(option);
        }
    });
}
</script>
{/block}